﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sasa.QualityTools.CodeAnalysis.Core.Models;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.ViewModels.Configurations
{
    public class BuildConfigurationViewModel : ViewModelBase
    {
        public event EventHandler ShowProjectSiteRequired;


        private MSBuildProject model;


        public bool CanIntegrateMSBuild
        {
            get
            {
                return model.CanIntegrateMSBuild;
            }
            set
            {
                model.CanIntegrateMSBuild = value;
                OnPropertyChanged("CanIntegrateMSBuild");
            }
        }

        public bool EnableCodeInspectionOnBuild
        {
            get
            {
                return model.EnableCodeInspectionOnBuild;
            }
            set
            {
                model.EnableCodeInspectionOnBuild = value;
                OnPropertyChanged("EnableCodeInspectionOnBuild");
            }
        }

        public bool EnableCodeMetricsCalculationOnBuild
        {
            get
            {
                return model.EnableCodeMetricsCalculationOnBuild;
            }
            set
            {
                model.EnableCodeMetricsCalculationOnBuild = value;
                OnPropertyChanged("EnableCodeMetricsCalculationOnBuild");
            }
        }


        public RelayCommand ShowProjectSiteCommand { get; private set; }


        public BuildConfigurationViewModel(MSBuildProject model)
        {
            this.model = model;
            ShowProjectSiteCommand = new RelayCommand(o => ShowProjectSite());
        }


        public void ShowProjectSite()
        {
            if (ShowProjectSiteRequired != null)
            {
                ShowProjectSiteRequired(this, EventArgs.Empty);
            }
        }
    }
}
